package com.hb.trade.server.project.opening.manager;

import com.hb.core.pojo.project.opening.dto.BidOpeningScheduleDTO;
import com.hb.core.pojo.project.opening.entity.BidOpeningSchedule;

import java.util.List;

/**
 * 开标一览表Manager
 *
 * @author zhaojk
 * @date 2021-12-10 17:27:26
 */
public class BidOpeningScheduleManager extends BidOpeningScheduleDTO {

    /**
     * 获取可以直接添加数据库的开标项数据
     *
     * @return
     */
    public List<BidOpeningSchedule> getBatchData() {
        List<BidOpeningSchedule> bidOpeningSchedules = getBidOpeningSchedules();
        for (int i = 0; i < bidOpeningSchedules.size(); i++) {
            BidOpeningSchedule schedule = bidOpeningSchedules.get(i);
            schedule.setFileId(getFileId());
            // 这里将ID设置为null, buildBaseData方法会重新设置ID值
            schedule.setId(null);
            schedule.setSortNum(i);
            schedule.buildBaseData(1);
        }
        return bidOpeningSchedules;
    }
}
